home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / stddef.h < prev    next >
C/C++ Source or Header  |  1994-04-25  |  6KB  |  224 lines

  1. #ifndef _STDDEF_H
  2. #ifndef _STDDEF_H_
  3. #ifndef _ANSI_STDDEF_H
  4. #ifndef __STDDEF_H__
  5.  
  6. /* Any one of these symbols __need_* means that GNU libc
  7.    wants us just to define one data type.  So don't define
  8.    the symbols that indicate this file's entire job has been done.  */
  9. #if (!defined(__need_wchar_t) && !defined(__need_size_t)    \
  10.      && !defined(__need_ptrdiff_t) && !defined(__need_NULL))
  11. #define _STDDEF_H
  12. #define _STDDEF_H_
  13. /* snaroff@next.com says the NeXT needs this.  */
  14. #define _ANSI_STDDEF_H
  15. /* Irix 5.1 needs this.  */
  16. #define __STDDEF_H__
  17. #endif
  18.  
  19. #ifndef __sys_stdtypes_h
  20. /* This avoids lossage on SunOS but only if stdtypes.h comes first.
  21.    There's no way to win with the other order!  Sun lossage.  */
  22.  
  23. /* On 4.3bsd-net2, make sure ansi.h is included, so we have
  24.    one less case to deal with in the following.  */
  25. #if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__)
  26. #include <machine/ansi.h>
  27. #endif
  28.  
  29. /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
  30.     defined if the corresponding type is *not* defined.  */
  31. #ifdef _ANSI_H_
  32. #ifndef _SIZE_T_
  33. #define _SIZE_T
  34. #endif
  35. #ifndef _PTRDIFF_T_
  36. #define _PTRDIFF_T
  37. #endif
  38. #ifndef _WCHAR_T_
  39. #define _WCHAR_T
  40. #endif
  41. /* Undef _FOO_T_ if we are supposed to define foo_t.  */
  42. #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
  43. #undef _PTRDIFF_T_
  44. #endif
  45. #if defined (__need_size_t) || defined (_STDDEF_H_)
  46. #undef _SIZE_T_
  47. #endif
  48. #if defined (__need_wchar_t) || defined (_STDDEF_H_)
  49. #undef _WCHAR_T_
  50. #endif
  51. #endif /* _ANSI_H_ */
  52.  
  53. /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
  54.    Just ignore it.  */
  55. #if defined (__sequent__) && defined (_PTRDIFF_T_)
  56. #undef _PTRDIFF_T_
  57. #endif
  58.  
  59. /* In case nobody has defined these types, but we aren't running under
  60.    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
  61.    __WCHAR_TYPE__ have reasonable values.  This can happen if the
  62.    parts of GCC is compiled by an older compiler, that actually
  63.    include gstddef.h, such as collect2.  */
  64.  
  65. /* Signed type of difference of two pointers.  */
  66.  
  67. /* Define this type if we are doing the whole job,
  68.    or if we want this type in particular.  */
  69. #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
  70. #ifndef _PTRDIFF_T    /* in case <sys/types.h> has defined it. */
  71. #ifndef _T_PTRDIFF_
  72. #ifndef _T_PTRDIFF
  73. #ifndef __PTRDIFF_T
  74. #ifndef _PTRDIFF_T_
  75. #ifndef ___int_ptrdiff_t_h
  76. #ifndef _GCC_PTRDIFF_T
  77. #define _PTRDIFF_T
  78. #define _T_PTRDIFF_
  79. #define _T_PTRDIFF
  80. #define __PTRDIFF_T
  81. #define _PTRDIFF_T_
  82. #define ___int_ptrdiff_t_h
  83. #define _GCC_PTRDIFF_T
  84. #ifndef __PTRDIFF_TYPE__
  85. #define __PTRDIFF_TYPE__ long int
  86. #endif
  87. typedef __PTRDIFF_TYPE__ ptrdiff_t;
  88. #endif /* _GCC_PTRDIFF_T */
  89. #endif /* ___int_ptrdiff_t_h */
  90. #endif /* _PTRDIFF_T_ */
  91. #endif /* __PTRDIFF_T */
  92. #endif /* _T_PTRDIFF */
  93. #endif /* _T_PTRDIFF_ */
  94. #endif /* _PTRDIFF_T */
  95.  
  96. /* If this symbol has done its job, get rid of it.  */
  97. #undef    __need_ptrdiff_t
  98.  
  99. #endif /* _STDDEF_H or __need_ptrdiff_t.  */
  100.  
  101. /* Unsigned type of `sizeof' something.  */
  102.  
  103. /* Define this type if we are doing the whole job,
  104.    or if we want this type in particular.  */
  105. #if defined (_STDDEF_H) || defined (__need_size_t)
  106. #ifndef _SIZE_T    /* in case <sys/types.h> has defined it. */
  107. #ifndef _SYS_SIZE_T_H
  108. #ifndef _T_SIZE_
  109. #ifndef _T_SIZE
  110. #ifndef __SIZE_T
  111. #ifndef _SIZE_T_
  112. #ifndef ___int_size_t_h
  113. #ifndef _GCC_SIZE_T
  114. #ifndef _SIZET_
  115. #ifndef __size_t
  116. #define _SIZE_T
  117. #define _SYS_SIZE_T_H
  118. #define _T_SIZE_
  119. #define _T_SIZE
  120. #define __SIZE_T
  121. #define _SIZE_T_
  122. #define ___int_size_t_h
  123. #define _GCC_SIZE_T
  124. #define _SIZET_
  125. #define __size_t
  126. #ifndef __SIZE_TYPE__
  127. #define __SIZE_TYPE__ long unsigned int
  128. #endif
  129. #if !(defined (__GNUG__) && defined (size_t))
  130. typedef __SIZE_TYPE__ size_t;
  131. #endif /* !(defined (__GNUG__) && defined (size_t)) */
  132. #endif /* __size_t */
  133. #endif /* _SIZET_ */
  134. #endif /* _GCC_SIZE_T */
  135. #endif /* ___int_size_t_h */
  136. #endif /* _SIZE_T_ */
  137. #endif /* __SIZE_T */
  138. #endif /* _T_SIZE */
  139. #endif /* _T_SIZE_ */
  140. #endif /* _SYS_SIZE_T_H */
  141. #endif /* _SIZE_T */
  142. #undef    __need_size_t
  143. #endif /* _STDDEF_H or __need_size_t.  */
  144.  
  145.  
  146. /* Wide character type.
  147.    Locale-writers should change this as necessary to
  148.    be big enough to hold unique values not between 0 and 127,
  149.    and not (wchar_t) -1, for each defined multibyte character.  */
  150.  
  151. /* Define this type if we are doing the whole job,
  152.    or if we want this type in particular.  */
  153. #if defined (_STDDEF_H) || defined (__need_wchar_t)
  154. #ifndef _WCHAR_T
  155. #ifndef _T_WCHAR_
  156. #ifndef _T_WCHAR
  157. #ifndef __WCHAR_T
  158. #ifndef _WCHAR_T_
  159. #ifndef _WCHAR_T_H
  160. #ifndef ___int_wchar_t_h
  161. #ifndef __INT_WCHAR_T_H
  162. #ifndef _GCC_WCHAR_T
  163. #define _WCHAR_T
  164. #define _T_WCHAR_
  165. #define _T_WCHAR
  166. #define __WCHAR_T
  167. #define _WCHAR_T_
  168. #define _WCHAR_T_H
  169. #define ___int_wchar_t_h
  170. #define __INT_WCHAR_T_H
  171. #define _GCC_WCHAR_T
  172. #ifndef __WCHAR_TYPE__
  173. #define __WCHAR_TYPE__ int
  174. #endif
  175. typedef __WCHAR_TYPE__ wchar_t;
  176. #endif
  177. #endif
  178. #endif
  179. #endif
  180. #endif
  181. #endif
  182. #endif
  183. #endif
  184. #endif
  185. #undef    __need_wchar_t
  186. #endif /* _STDDEF_H or __need_wchar_t.  */
  187.  
  188. /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
  189.     are already defined.  */
  190. #ifdef _ANSI_H_
  191. #ifdef _GCC_PTRDIFF_T_
  192. #undef _PTRDIFF_T_
  193. #endif
  194. #ifdef _GCC_SIZE_T_
  195. #undef _SIZE_T_
  196. #endif
  197. #ifdef _GCC_WCHAR_T_
  198. #undef _WCHAR_T_
  199. #endif
  200. #endif /* _ANSI_H_ */
  201.  
  202. #endif /* __sys_stdtypes_h */
  203.  
  204. /* A null pointer constant.  */
  205.  
  206. #if defined (_STDDEF_H) || defined (__need_NULL)
  207. #undef NULL        /* in case <stdio.h> has defined it. */
  208. #define NULL ((void *)0)
  209. #endif    /* NULL not defined and <stddef.h> or need NULL.  */
  210. #undef    __need_NULL
  211.  
  212. #ifdef _STDDEF_H
  213.  
  214. /* Offset of member MEMBER in a struct of type TYPE.  */
  215.  
  216. #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
  217.  
  218. #endif /* _STDDEF_H was defined this time */
  219.  
  220. #endif /* __STDDEF_H__ was not defined before */
  221. #endif /* _ANSI_STDDEF_H was not defined before */
  222. #endif /* _STDDEF_H_ was not defined before */
  223. #endif /* _STDDEF_H was not defined before */
  224.